﻿<controls:ChildWindow xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:local="clr-namespace:RialternativeSample.Client.Controls"
                      xmlns:ctrlTk="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
                      xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
                      x:Class="RialternativeSample.Client.Views.LoginView"
                      KeyDown="LoginForm_KeyDown"
                      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                      Width="400"
                      Title="Authentication"
                      DataContext="{Binding LoginViewModel, Source={StaticResource ViewModelLocator}}"
                      Style="{StaticResource LogRegWindowStyle}"
                      mc:Ignorable="d">
    <StackPanel>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition />
            </Grid.RowDefinitions>

            <ctrlTk:BusyIndicator x:Name="busyIndicator"
                                  BusyContent="Logging In"
                                  IsBusy="{Binding LoginInfo.IsLoggingIn}">
                <StackPanel Orientation="Vertical">
                    <local:CustomDataForm x:Name="loginForm"
                                          Padding="10,0,10,0"
                                          CurrentItem="{Binding LoginInfo}"
                                          IsEnabled="{Binding LoginInfo.IsLoggingIn, Converter={StaticResource NotOperatorValueConverter}}"
                                          AutoEdit="True"
                                          CommandButtonsVisibility="None"
                                          HeaderVisibility="Collapsed"
                                          AutoGeneratingField="LoginForm_AutoGeneratingField"
                                          Style="{StaticResource LoginDataFormStyle}" />
                </StackPanel>
            </ctrlTk:BusyIndicator>

            <StackPanel Grid.Row="1"
                        Grid.Column="1"
                        Orientation="Horizontal"
                        HorizontalAlignment="Right"
                        Margin="0,0,10,0">
                <Button x:Name="loginButton"
                        Content="OK"
                        Command="{Binding LoginCommand}"
                        Style="{StaticResource RegisterLoginButtonStyle}"
                        IsEnabled="{Binding Path=CanLogIn}" />
                <Button x:Name="loginCancel"
                        Content="Cancel"
                        Command="{Binding CancelLoginCommand}"
                        Style="{StaticResource RegisterLoginButtonStyle}" />
            </StackPanel>
        </Grid>
    </StackPanel>
</controls:ChildWindow>